// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import App from './App';
import router from './router';
import VueResource from 'vue-resource';
import ElementUI from 'element-ui';
import VueAwesomeSwiper from 'vue-awesome-swiper';
//vuex状态管理
import 	Vuex from 'vuex';

Vue.use(Vuex);
Vue.use(VueResource);
Vue.use(VueAwesomeSwiper);
Vue.use(ElementUI);
// 引入css js
import './assets/css/reset.css';
import './assets/js/flexible.js';
import './assets/css/swiper.css';
import './assets/css/animate.css';
import './assets/js/cookie.js';
Vue.use(Vuex);

//创建store仓库
let store = new Vuex.Store({
	//仓库储存数据
	state:{
		tree:false,
		fonr:false,
		//把要添加购物车的商品初始化对象，用获取对象属性的方法得到商品里的信息
		cartFoots:{
		},
		//商品的ID
		footId:""
	},
	//调用store里的数据
	mutations:{
		changex(state){
			state.tree=!state.tree
		},
		changec(state){
			state.fonr=!state.fonr	
		},
		//添加商品
		addcart(state,foo){
			//获取对象属性的方法，中括号法
			//var obj = {'name':'张三','age':'18'};
			//var getName = obj.name;//点方法
			//var getAge = obj['age'];//中括号法
			state.cartFoots[foo.productId] = foo
			//当前商品的id，后面为一个对象
		},
		getfootId(state,id){
			state.footId=id
		}

	},
	actions:{

	}
})
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  Vuex,
  store,
  template: '<App/>',
  components: { App }
})
